package com.example.flex.domain;

import com.example.flex.listener.UserRoleListener;
import com.mybatisflex.annotation.RelationManyToOne;
import com.mybatisflex.annotation.Table;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * 用户角色关联表实体类
 * @Author: 不是菜鸡爱编程
 * @Date:
 * @Description：
 */
@Table(value = "user_role",
    onInsert = UserRoleListener.class,
    onUpdate = UserRoleListener.class
)
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "UserRoleEntity",description = "用户角色关联表")
public class UserRoleEntity implements Serializable {
    /**
     * 用户编号
     */
    @ApiModelProperty("用户编号")
    private Long userId;
    /**
     * 角色编号
     */
    @ApiModelProperty("角色编号")
    private Long roleId;

    /**
     * 角色实体
     */
    @RelationManyToOne(selfField = "roleId", targetField = "id")
    @ApiModelProperty("用户角色关联表对应的角色")
    private RoleEntity roleEntity;
}